package org.mozhu.zufang.admin.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.mozhu.mboot.core.ApplicationContextWrapper;
import org.mozhu.mboot.core.web.bind.ControllerDefaultsSupport;
import org.mozhu.zufang.admin.service.UserAuditorAware;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class CommonConfiguration {

    @Bean
    UserAuditorAware userAuditorAware() {
        return new UserAuditorAware();
    }

    @Bean
    public ApplicationContextWrapper applicationContextWrapper() {
        return new ApplicationContextWrapper();
    }

    @Bean
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource druid() {
        return new DruidDataSource();
    }

    @Bean
    public ControllerDefaultsSupport controllerDefaultsSupport() {
        return new ControllerDefaultsSupport();
    }
}
